<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ page import="net.lwf.handler.util.ImageHtml"%>
<html>
   <bean:define id="ap" name="waform" property="formaction" />
   <%
      String actionPath = String.valueOf(ap);
      String checkAnsURL = request.getContextPath() + actionPath + ".do?";
      String operationURL = request.getContextPath() + actionPath + ".do?action=selectoperation&qtype=" + actionPath.substring(1);
    %>
   <head>
	   <script>
		  function processURL() {
		    document.getElementById("introblock").innerHTML = '';
		    document.getElementById("answercheckblock").innerHTML = '';
			//url = '/lwf/simpleprocess.do?action=selectoperation';
			url = '<%=operationURL%>';
		    retrieveURL(url, 'questionblock');
		  }
		  
		  function checkAnswer() {
		  	var userans = getCheckedRadio("choice");
		  	//url = '/lwf/simpleprocess.do?action=checkanswer&useranswer=' + userans;
		  	url = '<%=checkAnsURL%>action=checkanswer&useranswer=' + userans;
		  	//alert(url);
		    retrieveURL(url, 'answercheckblock');
		  } 
		  
		  function processEnterKey() {
		     if(window.event.keyCode == 13) {
		        alert('Enter Key Pressed');
		        checkAnswer();
		     }
		  }
	   </script>
   </head>
   

   <html:form action="<%=actionPath%>" >
   <table border="0" align="center" width="100%" bordercolor="red"> 
       <tr>
           <td>
               <span id="introblock">
                   <%=ImageHtml.getStartButton("processURL()")%>
               </span>
           </td>
       </tr>         
       <tr>
           <td>
               <table border="0" width="100%">
                  <tr>
                      <td>
                         <span id="questionblock"></span>
                      </td>
                  </tr>                  
               </table>
           </td>
       </tr> 
   </table>  
</html:form>

</html>